package com.xqnode.provider;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;


@SpringBootApplication
@EnableDiscoveryClient
@RestController
@RefreshScope
@Slf4j
public class Application {

    @Value("${server.port}")
    private String port;

    @Value("${config:}")
    private String config;

    public static void main(String[] args) {
        SpringApplication.run(Application.class);
    }

    @GetMapping("/provider/{param}")
    public String get(@PathVariable String param) {
        log.info("获取到的配置：{}", config);
        return "server.port=" + port + ", param=" + param + ", config=" + config;
    }
}
